package com.spsoft.vatoutinv.service.translate.impl;

import com.spsoft.vatoutinv.constants.TranslateConstant;
import com.spsoft.vatoutinv.service.translate.TranslateService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wangy
 * @date 2023/11/27 16:30
 */
@Data
@Service
public class TranslateMap {

    @Autowired
    DateTranslate dateTranslate;

    @Autowired
    DictTranslate dictTranslate;

    public final static Map<String, TranslateService> MAP = new HashMap<>(2);

    @PostConstruct
    public void buildTranslateMap(){
        MAP.put(TranslateConstant.DICT,dictTranslate);
        MAP.put(TranslateConstant.DATE,dateTranslate);
    }

    public static TranslateService getTranslateMap(String translateType){
        return MAP.get(translateType);
    }

}
